'use strict';

const conn = require('../../libs/Conn');

module.exports = async function (params) {
    let querySql = ``;
    if(params.type === '0'){
        querySql = `SELECT
                        '全部' AS dataType,
                        '0' AS value
                    
                    UNION
                        SELECT
                            structure_name AS dataType,
                            structure_id AS value
                        FROM
                            structure_file 
                        WHERE delete_sign = 1 AND enable = 1`;
    }else{
        querySql = `
                        SELECT
                            structure_name AS dataType,
                            structure_id AS value
                        FROM
                            structure_file 
                        WHERE delete_sign = 1 AND enable = 1`;
    }
    let rec = await conn(querySql);
    return {success: true, data: rec};

};